﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NLBS.Entity;
using NLBS.Data;
using NLBS.Framework;
using NLBS.Text;

namespace NLBS.Control
{
    /// <summary>
    /// NLBS控件，用于显示公告
    /// </summary>
    [ToolboxData("<{0}:Announce runat=server></{0}:Announce>")]
    [Designer(typeof(EmptyDesigner))]
    public class Announce : System.Web.UI.Control
    {

        protected override void Render(HtmlTextWriter write)
        {
            BlogInfo info = BlogInfo.Instance();
            if (info.AnnounceShow == 0)
                return;
            write.AddAttribute(HtmlTextWriterAttribute.Class, "announce");
            write.RenderBeginTag(HtmlTextWriterTag.Div);
            write.AddAttribute(HtmlTextWriterAttribute.Class, "announce-content");
            write.RenderBeginTag(HtmlTextWriterTag.Div);
            write.AddAttribute(HtmlTextWriterAttribute.Class, "announce-time");
            write.RenderBeginTag(HtmlTextWriterTag.Div);
            write.Write(info.AnnounceDate);
            write.RenderEndTag();
            write.RenderBeginTag(HtmlTextWriterTag.Span);
            write.AddStyleAttribute(HtmlTextWriterStyle.FontFamily, "Georgia");
            write.Write(LBSTextHelper.lbsUBB(info.Announce, info.announceUBBFlags));
            write.RenderEndTag();
            write.Write("<br />");
            write.RenderEndTag();
            write.RenderEndTag();
        }
    }
}
